package org.nanotek.lucene.document.config;

import java.util.Set;

import org.nanotek.AbstractBase;
import org.nanotek.Base;
import org.nanotek.Document;
import org.nanotek.DocumentBase;

/**
 * NOT YET FINISHED
 * 
 * A "Lucene Document"  basically is a collection of Fields under the domain 
 * of the application, it is the "Interpreter class" which reads the internal Lucene configuration 
   for a given Index->Document(s), a Lucene Index can hold different type of documents (which on it turns
   is a relation of fields), but for the application each document holds a reference since such document 
   has a source of "retrieval", and such metadata is persisted on a specific mechanism, (on this case
   a PostgreSQL database).  
   
   It is implemented just as a "Sample" for now on how the DocumentBase shall work, the idea is quite simple, 
   K is a "generic Key" on "Base<?> store mechanism, before call the method "getDocument" which is the "Document" underlaying 
   the main class. The implementor shall use the getDocumentBase, which returns the Base class based on it's key, 
   recovered the Key the implementor shall call the getDocument Object, simple but trick, since the "Base Key" class, can be 
   a key for other elements related to the document but not contained on the document since are not part of the document. 
   
   It is useful for example to create a relation "Persons to Document" without explicit the relation neither on Person Neither on Document, assuring that 
   exists a separation of concerns without defining how such separation of concerns shall work. 
 *
 * 
 * @author josecanovamauger
 *
 */

@SuppressWarnings("serial")
public class LuceneDocument extends AbstractBase<Base<Long>> implements DocumentBase<Base<Long> , Long , LuceneDocument>{

	private Set <Field> fields; 
	
	private LuceneDocument()
	{}
	
	private LuceneDocument(Set<Field> fields)
	{ 
		this.fields = fields;
	}
	
	public Set<Field> getFields() {
		return fields;
	}

	public void setFields(Set<Field> fields) {
		this.fields = fields;
	}

	@Override
	public Document<LuceneDocument, Base<Long>> getDocument(Base<Long> base) {
		return null;
	}

	@Override
	public Class<Document<LuceneDocument, Base<Long>>> get() {
		Class<Document<LuceneDocument, Base<Long>>> clazz = null; 
		try { 
			clazz =  (Class<Document<LuceneDocument, Base<Long>>>) Class.forName(this.getClass().getName(), false, this.getClass().getClassLoader());
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return clazz;
	}

	@Override
	public Base<Long> getDocumentBase(Long key) {
		return null;
	}

}
